<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jquery.min.js"></script>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <script>
        arr = ["red", "pink", "skyblue"];
        $(function() {
            // each方法内要有回调函数，index是索引，代表第几个元素，domEle代表这个元素的DOM对象
            // $("div").each(function(index, domEle) {
            //     $(domEle).css("color", arr[index]);
            // })
            // 可以遍历数据，数组对象等
            $.each($("div"), function(index, dom){
                $(dom).css("color", arr[index]);
            })
        })
    </script>
</body>
</html>